import React from 'react'
import PageJson from 'containers/setting/allocate-center/page-json';
import { Row, Col } from 'antd';

const TitleHoc = WrappedComponent => {
  class hoc extends React.Component{
    constructor(props){
      super(props);
    }

    getTitle = key => {
      let result = [];
      if (PageJson[key]) {
        PageJson[key].map(item => {
          result.push(<Row style={{fontSize: '14px', marginBottom: '10px'}}>
            <Col span={2} style={{ color: '#4E5B71' }}>{item.title}：</Col>
            <Col span={22}>{item.content}</Col>
          </Row>)
        })
      }
      return result;
    };

    render(){
      return(
        <WrappedComponent
          getTitle={this.getTitle}
          {...this.props}
        />
      )
    }
  }

  return hoc;
};

export default TitleHoc;
